/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dao;

import java.util.List;
import org.hibernate.HibernateException;
import pojos.TipoTransaccion;

/**
 *
 * @author Usuario
 */
public class TipoTransaccionDao extends AbstractDao{
    
    public String createTipoTransaccion(TipoTransaccion tipo) {
        String save = "";
        try {
            startOperation();
            save = (String) getSession().save(tipo);
            getTransaction().commit();
        } catch (HibernateException he) {
            handleException(he);
            throw he;
        } finally {
            super.closeSession();
        }
        return save;
    }
    
    public void updateTipoTransaccion(TipoTransaccion tipo){
        super.saveOrUpdate(tipo);
    }
    
    public List<TipoTransaccion> findAll(){
        return (List<TipoTransaccion>) super.findAll(TipoTransaccion.class, "");
    }
    
    public TipoTransaccion findById(String id){
        return (TipoTransaccion)super.find(TipoTransaccion.class, id);
    }
}
